#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    vector<int> v1 = {1, 2, 3, 4, 5};
    vector<int> v2(5);

    int arr1[] = {1, 2, 3, 4, 5};
    int arr2[5] = {0};

    // copy(v1.begin(), v1.end(), v2.begin());
    copy(v1.begin(), v1.end(), v2.begin());
    for (auto i : v2)
    {
        cout << i << " ";
    }
    cout << endl;

    auto ret = copy_if(arr1, arr1 + 5, arr2, [](int n)
                       { return n % 2 == 0; });
    int length = ret - arr2;

    for (int i = 0; i < length; i++)
    {
        cout << arr2[i] << " ";
    }
    cout << endl;

    return 0;
}